Area of Interest: Are there sociodemographic disparities in the rate of pediatric emergency room short-term revisits (re-presenting to the ED within 72 hours)?
Mentors:
Joseph Zorc, MD, MSCE. Professor of Pediatrics, Mark Fishman Endowed Chair in Genomics and Computational Science, and Director of Emergency Information Systems. Division of Emergency Medicine, Department of Pediatrics, Children’s Hospital of Philadelphia.
Reviewed key factors of interest, including demographics, language proficiency, acuity, admission status, as well as clearly defining the “revisit” variable
Brandon C. Ku, MD. Associate Professor of Pediatrics, Associate Medical Director of Clinical Pathways Program, and Associate Director of Quality Improvement. Divison of Emergency Medicine, Department of Pediatrics, Children’s Hospital of Philadelphia.
Discussed primary and secondary outcome measures of the project as well as the optimal visualizations of the variables of interest.
2 Introduction
Pediatric emergency care (PEC) is a complex and fast-paced environment that treats patients across the healthcare and socio-demographic spectrums. Recently, there has been increasing focus on overall care quality and disparities in PEC. Disparities are known to exist in timely pain management by patient race and that those with non-English language proficiency have an increased risk of adverse medical events. Revisits, or returning to the emergency department within 72 hours of discharge, are an important marker of care quality and performance indicator of a department. While patients represent to the emergency room following a visit for various reasons, including progression of disease or repeat medication administration, it may signal incomplete ED care or insufficient anticipatory guidance. Revisits are also associated with increased healthcare costs, over-crowding and system stress, and decreased satisfaction of both families and staff.
Understanding the disparities associated with increased revisit rates and discovering modifiable factors is needed to offer solutions. This study will examine the association of sociodemographic and visit-specific factors that are associated with revisits that result either in a repeat discharge or hospitalization.
3 Methods
3.0.1 Study Design
This is a retrospective study of patients, between 0-18 years old, presenting to a tertiary, academic pediatric emergency department between November 01, 2021 to November 01, 2023. Data was accessed through the institutional data warehouse, extracted from patient and encounter-level tables, deidentified, and downloaded as a CSV file.
Outcome Measures
The primary outcomes were return visits within 72 hours regardless of revisit encounter disposition, and return visits in 72 hours that resulted in admission, including observation, to the hospital.
Factor Inclusion
A priori, we selected both visit and patient-level factors. Visit-level factors included daily volume (separated into quartiles for each Campus), daily median acuity, daily median wait time, time of arrival to the ED (daytime: 7a to 3p, evening: 3p to 11p, overnight: 11p to 7a), length of stay, disposition type (discharged, Against Medical Advise (AMA)/Eloped) and ED location (main vs community campus).
1Sex is being used based on availability and labeling in the data warehouse and is being treated as dichotomous. Author recognizes non-binary gender as the more appropriate variable to be used.
Patient-level factors include age (<1 year and > 1 year) , sex1, race/ethnicity (Non-Hispanic White, Non-Hispanic Black, Hispanic, Other), preferred language (English, Non-English), individual triage acuity (1-5), history of complex medical conditions (Y/N), insurance status (Commercial, Government, Charity Care, Self-Pay), Childhood Opportunity Index (COI; Very High to Very Low), and whether they had a primary care physician (PCP) visit within 72 hours of their index ED visit (Y/N)2.
2Other variables to include in future analyses include patient distance from the ED, green space access, and top diagnosis.
3.1 Install & Load Packages
Of note, most code is collapsed for easier visualization. Please click on “code” to expand to view.
#Read in CSV Filedata<-read.csv("./EDRevisits.csv")#Convert data types as neededdata[data=='']<-NA#converts blanks to NAdata$ENCOUNTER_DATE <-mdy(data$ENCOUNTER_DATE)data$WAITTIME<-period_to_seconds(hms(data$WAITTIME))data$ARRIVALTIME<- lubridate::hms(data$ARRIVALTIME)data$DAILYVISITS<-as.numeric(as.integer(data$DAILYVISITS))#Convert Wait Time from HMS to Minutes and Hoursdata<- data|>mutate(waitmin = WAITTIME/60)|>mutate(waithr = WAITTIME/(60*60))
Continuous variables were summarized using mean, median, and interquartile range, as appropriate.
Categorical variables were summarized using frequencies and percentages.
A portion of these variables were collapsed into dichotomous variables based on previous research.
A total of 211,583 patients < 19 years old were seen across both emergency department campuses between November 1, 2021 and November 1, 2023. There is a notable difference in daily visits between both campuses, which is expected given the bed availability is much larger at main (~56) compared to community (~21). Average acuity was 3.2 and 3.13. Median wait time was 24 minutes and 19 minutes. Median length of stay (LOS) was 3.22 hours and 3.43 hours. At the main campus, a total of 6938 (4.4%) patients returned to the ED following their index visit, and of those 1722 (1.1%) were admitted to the hospital. At the community campus, 2758 (5.1%) patient returned within 72 hours, and 818 (1.5%) were admitted to the hospital.
Code
#Overall Emergency Department Summarytbl_summary(data, include =c(DAILYVISITS, AVGESI, waitmin, ED_LOS, revisit),statistic =list(all_continuous() ~"{median} ({p25}, {p75})" ),by = CAMPUS,missing ="no")|>modify_caption ("**Table 1: Emergency Department Characteristics**") |>modify_header (label ="") |>bold_labels()|>as_gt()|> gt::tab_options(table.font.size =14)
Table 1: Emergency Department Characteristics
Main, N = 157,5221
Community, N = 54,0611
Daily Visits
277 (244, 307)
103 (90, 114)
Acuity
3.20 (3.15, 3.26)
3.13 (3.05, 3.21)
Wait Time (min)
24 (16, 46)
19 (6, 49)
Length of Stay (hr)
3.22 (2.07, 4.83)
3.43 (2.28, 4.95)
Revisit within 72 Hours
No Revisit
150,584 (96%)
51,303 (95%)
Revisit to Discharge
5,216 (3.3%)
1,940 (3.6%)
Revisit to Admission
1,722 (1.1%)
818 (1.5%)
1 Median (IQR); n (%)
Department Summary Visualizations
Select between tabs to visualize different variables.
Preliminary exploratory analysis, including Chi-Square and Univariable Logistic Regression, were performed on all variables included in the data set (expand below to see output).
Chi-Squares and Univariable Regressions
Code
# Create subset for chi-squaredf<-data%>%select(SEX, LANGIND, eth_cat, PAYOR_GROUP, COI, ACUITY, Arrival, volume, age_cat, esigp, COMPLEX_CHRONIC_CONDITION_IND, PCP_VISIT_72_HR, CAMPUS, ED_DISPOSITION)#Convert to Dataframedf2<-map_df(df,~chisq_test(.x, data$REVISIT_72_HR))#Create list of variable labels and convert to dataframemylist <-list(var_label(df))df3 <-data.frame("Variable"=unlist(mylist, use.names =FALSE) )#Combine the two dataframesdf4<-cbind(df3,df2)#Create tabledf4<-df4|>select(-n, -method)flextable::set_flextable_defaults(digits =3)ftdf<-flextable::as_flextable(df4)ftdf<-ftdf|> flextable::bold(i=~p <0.05, j ="p")|> flextable::bold(part ="header")|> flextable::fontsize(size =10, part ="all")|> flextable::add_header_lines("Chi-Square Tests: Any Revisit")ftdf
Chi-Square Tests: Any Revisit
Variable
statistic
p
df
p.signif
character
numeric
numeric
integer
character
Sex
0.050
0.823
1
ns
Language
1.853
0.173
1
ns
Race/Ethnicity
27.051
0.000
3
****
Insurance Type
16.314
0.001
3
***
Childhood Opportunity Index
22.233
0.000
4
***
Acuity
381.294
0.000
4
****
Arrival
52.845
0.000
2
****
ED Volume (Categorical)
6.272
0.099
3
ns
Age (Categorical)
223.855
0.000
1
****
Acuity (Dichotomized)
315.572
0.000
1
****
n: 14
Code
#Create subset to include in regressionlf<-data|>select(SEX, LANGIND, AGE_AT_VISIT, ED_LOS, eth_cat, PAYOR_GROUP, COI, ACUITY, Arrival, volume, waithr, age_cat, esigp, COMPLEX_CHRONIC_CONDITION_IND, PCP_VISIT_72_HR, CAMPUS, ED_DISPOSITION,REVISIT_72_HR)#Regression and Tablet1<-lf|>tbl_uvregression(method = glm, y = REVISIT_72_HR,method.args =list(family=binomial()),exponentiate =TRUE,hide_n =TRUE)|>bold_p(t=0.05)|>italicize_levels()|>modify_caption ("**Table 1: Emergency Department Characteristics**") |>modify_header (label ="") |>bold_labels()t1|>as_gt()|> gt::tab_options(table.font.size =14, container.height =500)
Table 1: Emergency Department Characteristics
OR1
95% CI1
p-value
Sex
Male
—
—
Female
1.00
0.96, 1.04
0.8
Language
English
—
—
Other
0.95
0.88, 1.02
0.2
Age
0.97
0.97, 0.98
<0.001
Length of Stay (hr)
1.03
1.02, 1.03
<0.001
Race/Ethnicity
White
—
—
Black
0.88
0.84, 0.93
<0.001
Hispanic/Latino
0.98
0.92, 1.04
0.5
Other
0.95
0.89, 1.01
0.12
Insurance Type
Commercial
—
—
Government
1.02
0.98, 1.06
0.4
Charity Care
0.81
0.39, 1.48
0.5
Self Pay
0.64
0.50, 0.80
<0.001
Childhood Opportunity Index
Very High
—
—
High
1.06
0.98, 1.14
0.12
Moderate
0.97
0.90, 1.05
0.5
Low
0.95
0.88, 1.03
0.2
Very Low
0.92
0.87, 0.97
0.002
Acuity
1
—
—
2
1.51
0.76, 3.55
0.3
3
1.22
0.62, 2.88
0.6
4
0.90
0.46, 2.13
0.8
5
0.77
0.38, 1.84
0.5
Arrival
Daytime
—
—
Evening
1.01
0.97, 1.06
0.5
Overnight
1.24
1.17, 1.32
<0.001
ED Volume (Categorical)
High
—
—
Low
1.07
1.01, 1.14
0.014
Medium-High
1.03
0.97, 1.09
0.3
Medium-Low
1.05
0.99, 1.11
0.13
Wait Time (hr)
0.96
0.92, 0.99
0.010
Age (Categorical)
Child/Teen
—
—
Infant
1.49
1.41, 1.57
<0.001
Acuity (Dichotomized)
Acute
—
—
Non-Urgent
0.69
0.66, 0.72
<0.001
Complex or Chronic History
None
—
—
Chronic/Complex
1.54
1.46, 1.63
<0.001
PCP Visit within 72 Hours
No PCP Visit
—
—
PCP Visit
2.15
2.01, 2.30
<0.001
Campus
Main
—
—
Community
1.17
1.12, 1.22
<0.001
Disposition from ED
Discharge
—
—
AMA/Eloped
6.16
3.18, 11.1
<0.001
1 OR = Odds Ratio, CI = Confidence Interval
4.4 Multivariable Logistic Regression
In multivariable regression, the following characteristics were associated with a higher odds of revisit within 72 hours: being under 1 years old, having a longer length of stay at the index visit, having Governmental insurance, having a chronic or complex medical condition, index visit arrival during overnight shifts, having an index disposition of eloped or leaving against medical advice, having an index visit at the community campus, or having a visit with a primary care physician within 72 hours of the index visit. Of note, certain factors were associated with a lower odds of revisit. These included: having a longer index visit wait time, being Non-Hispanic Black, having an index acuity of non-urgent, or having no insurance/self-pay.
On return, patients were at higher odds of being admitted if they were under 1 years old, had a longer length of stay at the index visit, had a chronic or complex medical condition, had an index visit arrival during overnight shifts, had an index disposition of eloped/AMA, had an index visit at the community campus, or had a visit with a primary care physician within 72 hours of the index visit. Similarly, certain factors were associated with a lower odds of revisit. These included: having a longer index visit wait time, having an index acuity of non-urgent, or having no insurance/self-pay.
Code
#Create subset of only patient readmitted within 72 hoursreadmit <- data|>select(SEX, AGE_AT_VISIT, age_cat, esigp, eth_cat, LANGIND, PAYOR_GROUP, COI, ACUITY, COMPLEX_CHRONIC_CONDITION_IND, CAMPUS, ED_LOS, Arrival, ED_DISPOSITION, PCP_VISIT_72_HR, volume, waithr, READMIT_72_HR)
Code
# Regressionm.adm <-glm(READMIT_72_HR ~ SEX + age_cat + eth_cat + ED_LOS + LANGIND + PAYOR_GROUP + COI + esigp + COMPLEX_CHRONIC_CONDITION_IND + Arrival + ED_DISPOSITION + CAMPUS + PCP_VISIT_72_HR + volume + waithr, data = readmit, family =binomial())#Create Tablet.adm <-tbl_regression(m.adm, exponentiate =TRUE) %>%bold_p(t =0.05) %>%bold_labels() %>%italicize_levels()#Merge tables of Any Revisit and Readmissiontbl.merge<-tbl_merge(tbls =list(t3, t.adm),tab_spanner =c("**Any Revisit**", "**Revisit to Admission**"))#Table as gttbl.merge |>as_gt()|> gt::tab_options(table.font.size =14, container.height =500)|> gt::tab_caption("Table 3: Combined table of Multivariable Logistic Regressions by Revisit Status")
Table 3: Combined table of Multivariable Logistic Regressions by Revisit Status
Characteristic
Any Revisit
Revisit to Admission
OR1
95% CI1
p-value
OR1
95% CI1
p-value
Sex
Male
—
—
—
—
Female
1.00
0.96, 1.05
0.9
1.05
0.97, 1.13
0.3
Age (Categorical)
Child/Teen
—
—
—
—
Infant
1.39
1.32, 1.47
<0.001
2.10
1.91, 2.30
<0.001
Race/Ethnicity
White
—
—
—
—
Black
0.93
0.87, 1.00
0.049
0.92
0.81, 1.05
0.2
Hispanic/Latino
1.03
0.96, 1.12
0.4
1.09
0.94, 1.25
0.3
Other
0.95
0.89, 1.02
0.2
1.03
0.91, 1.18
0.6
Length of Stay (hr)
1.02
1.01, 1.02
<0.001
1.03
1.03, 1.04
<0.001
Language
English
—
—
—
—
Other
0.92
0.85, 1.00
0.061
0.85
0.71, 1.01
0.071
Insurance Type
Commercial
—
—
—
—
Government
1.17
1.11, 1.24
<0.001
1.00
0.90, 1.11
>0.9
Charity Care
0.99
0.47, 1.82
>0.9
0.00
0.00, 0.00
>0.9
Self Pay
0.75
0.58, 0.96
0.028
0.41
0.19, 0.74
0.008
Childhood Opportunity Index
Very High
—
—
—
—
High
1.07
0.99, 1.16
0.078
1.01
0.89, 1.16
0.8
Moderate
1.02
0.94, 1.11
0.6
0.91
0.77, 1.06
0.2
Low
1.05
0.95, 1.15
0.3
0.93
0.78, 1.10
0.4
Very Low
1.05
0.97, 1.14
0.2
0.95
0.82, 1.11
0.5
Acuity (Dichotomized)
Acute
—
—
—
—
Non-Urgent
0.77
0.74, 0.81
<0.001
0.35
0.32, 0.39
<0.001
Complex or Chronic History
None
—
—
—
—
Chronic/Complex
1.41
1.33, 1.49
<0.001
2.04
1.86, 2.23
<0.001
Arrival
Daytime
—
—
—
—
Evening
1.00
0.96, 1.05
0.9
1.06
0.97, 1.15
0.2
Overnight
1.18
1.11, 1.26
<0.001
1.23
1.09, 1.38
<0.001
Disposition from ED
Discharge
—
—
—
—
AMA/Eloped
5.14
2.64, 9.35
<0.001
10.4
4.70, 20.5
<0.001
Campus
Main
—
—
—
—
Community
1.18
1.11, 1.25
<0.001
1.21
1.09, 1.34
<0.001
PCP Visit within 72 Hours
No PCP Visit
—
—
—
—
PCP Visit
1.95
1.81, 2.09
<0.001
1.63
1.42, 1.86
<0.001
ED Volume (Categorical)
High
—
—
—
—
Low
1.04
0.97, 1.11
0.3
0.99
0.88, 1.12
>0.9
Medium-High
1.02
0.96, 1.08
0.6
1.02
0.91, 1.15
0.7
Medium-Low
1.02
0.96, 1.09
0.5
1.00
0.89, 1.12
>0.9
Wait Time (hr)
0.93
0.89, 0.96
<0.001
0.93
0.87, 1.00
0.047
1 OR = Odds Ratio, CI = Confidence Interval
Future evaluation will include predictive modeling using random forest.
5 Conclusion
At a tertiary, academic, free-standing children’s hospital with two emergency department campuses, 4.6% of patients returned to the ED within 72 hours of being discharged. Of those, 26% were admitted to the hospital on their return visit. This is consistent with national revisit trends at comparable children’s hospitals. Similar to previous studies, presence of chronic/complex conditions, younger age, and later ED arrival time were associated with increased risk for revisit.
When considering disparities, consistent with prior data, publicly insured individuals were more like to return to the ED, but were not more likely to be hospitalized upon return. Non-Hispanic Blacks were less likely to return, but were not less likely to be admitted upon return. Patients without insurance/self-pay were significantly less likely to revisit or be hospitalized upon return. This should be further explored to elucidate whether this is due to provider bias vs familial preference. It would also be interesting to examine whether these patients overall receive less workup and fewer diagnostic tests. Compared to other studies, there was no association between non-English language proficiency and increased risk of return. This may be explained by recent expanded hospital efforts to have video and in-person translators available in multiple languages. Childhood opportunity index was also not associated with revisit rates, contrary to previous studies.
Additionally, we found that patients who visited their PCP within 72 hours were associated with increased risk of hospitalization upon return. This goes against conventional belief that increased access to one’s PCP should decrease need for ED use. The current findings may may be explained if sicker patients are more likely to request PCP follow-up, but further exploration is necessary, particularly by examining outcomes of the associated PCP visits and whether ED referrals from said visits were made.
There are some notable limitations of this study. First, reason for revisit is not easily assessed. Patients may return to the ED for many reasons, including disease progression, as instructed for repeat testing, or because of incomplete care or inadequate discharge instructions. We are also unable to determine if the patient is returning for a completely unrelated reason. Second, our data does not include a revisit to EDs outside of the single academic institution, so the true rate may be higher than reported. However, our rates are consistent with national averages.
Overall, this study has shown that certain patient and visit-level factors are associated with either an increased or decreased risk of revisit to the emergency department. Most patients who do re-present will be re-discharged, but those that aren’t tend to be younger and chronically ill. This work gives us benchmarks and better areas of focus to reduce disparities in care and provide appropriate resources to patients. Future efforts should examine the role of and the communication with the pediatrician at the index visit.
6 References
Akenroye, Ayobami T., et al. “Prevalence and predictors of return visits to pediatric emergency departments.” Journal of hospital medicine 9.12 (2014): 779-787.
Alessandrini, Evaline A., et al. “Return visits to a pediatric emergency department.” Pediatric emergency care 20.3 (2004): 166-171.
Cho CS, Shapiro DJ, Cabana MD, Maselli JH, Hersh AL. A national depiction of children with return visits to the emergency department within 72 hours, 2001–2007. Pediatr Emerg Care. (2012): 606-610.
Goldman, Ran D., Michael Ong, and Alison Macpherson. “Unscheduled return visits to the pediatric emergency department-one-year experience.” Pediatric emergency care 22.8 (2006): 545-549.
Jacobstein CR, Alessandrini EA, Lavelle JM, Shaw KN. Unscheduled revisits to a pediatric emergency department: risk factors for children with fever or infection-related complaints. Pediatr Emerg Care. (2005): 816-821.
LeDuc K, Rosebrook H, Rannie M, Gao D. Pediatric emergency department recidivism: demographic characteristics and diagnostic predictors. J Emerg Nurs. (2006): 131-138.
Source Code
---title: "Sociodemographic Disparities in Pediatric Emergency Department Revisit Rates"subtitle: "BMIN503/EPID600 Final Project"author: "Casey E. Pitts, MD"format: html: theme: flatly.scss fontsize: smaller toc: true toc-location: left toc-title: Summary code-overflow: wraptitle-block-banner: truetitle-block-banner-color: "#ecf0f1"warning: falsemessage: falseeditor: visualcode-fold: truecode-tools: truenumber-sections: trueembed-resources: true---------------------------------------------------------------------------## Overview {#sec-overview}**Area of Interest:\**Are there sociodemographic disparities in the rate of pediatric emergency room short-term revisits (re-presenting to the ED within 72 hours)?[Github Repo](https://github.com/pittsc/BMIN503_Final_Project)**Mentors:**\Joseph Zorc, MD, MSCE. Professor of Pediatrics, Mark Fishman Endowed Chair in Genomics and Computational Science, and Director of Emergency Information Systems. Division of Emergency Medicine, Department of Pediatrics, Children's Hospital of Philadelphia.- Reviewed key factors of interest, including demographics, language proficiency, acuity, admission status, as well as clearly defining the "revisit" variableBrandon C. Ku, MD. Associate Professor of Pediatrics, Associate Medical Director of Clinical Pathways Program, and Associate Director of Quality Improvement. Divison of Emergency Medicine, Department of Pediatrics, Children's Hospital of Philadelphia.- Discussed primary and secondary outcome measures of the project as well as the optimal visualizations of the variables of interest.## Introduction {#sec-introduction}Pediatric emergency care (PEC) is a complex and fast-paced environment that treats patients across the healthcare and socio-demographic spectrums. Recently, there has been increasing focus on overall care quality and disparities in PEC. Disparities are known to exist in timely pain management by patient race and that those with non-English language proficiency have an increased risk of adverse medical events. Revisits, or returning to the emergency department within 72 hours of discharge, are an important marker of care quality and performance indicator of a department. While patients represent to the emergency room following a visit for various reasons, including progression of disease or repeat medication administration, it may signal incomplete ED care or insufficient anticipatory guidance. Revisits are also associated with increased healthcare costs, over-crowding and system stress, and decreased satisfaction of both families and staff.Understanding the disparities associated with increased revisit rates and discovering modifiable factors is needed to offer solutions. This study will examine the association of sociodemographic and visit-specific factors that are associated with revisits that result either in a repeat discharge or hospitalization.## Methods {#sec-methods}#### Study DesignThis is a retrospective study of patients, between 0-18 years old, presenting to a tertiary, academic pediatric emergency department between November 01, 2021 to November 01, 2023. Data was accessed through the institutional data warehouse, extracted from patient and encounter-level tables, deidentified, and downloaded as a CSV file.**Outcome Measures**The primary outcomes were return visits within 72 hours regardless of revisit encounter disposition, and return visits in 72 hours that resulted in admission, including observation, to the hospital.**Factor Inclusion**A priori, we selected both visit and patient-level factors. Visit-level factors included daily volume (separated into quartiles for each Campus), daily median acuity, daily median wait time, time of arrival to the ED (daytime: 7a to 3p, evening: 3p to 11p, overnight: 11p to 7a), length of stay, disposition type (discharged, Against Medical Advise (AMA)/Eloped) and ED location (main vs community campus).::: {.column-margin style="bg: gray;"}^1^Sex is being used based on availability and labeling in the data warehouse and is being treated as dichotomous. Author recognizes non-binary gender as the more appropriate variable to be used.:::Patient-level factors include age (\<1 year and \> 1 year) , sex^1^, race/ethnicity (Non-Hispanic White, Non-Hispanic Black, Hispanic, Other), preferred language (English, Non-English), individual triage acuity (1-5), history of complex medical conditions (Y/N), insurance status (Commercial, Government, Charity Care, Self-Pay), Childhood Opportunity Index (COI; Very High to Very Low), and whether they had a primary care physician (PCP) visit within 72 hours of their index ED visit (Y/N)^2^.::: column-margin^2^Other variables to include in future analyses include *patient distance from the ED*, *green space access,* and *top diagnosis.*:::### Install & Load Packages::: column-marginOf note, most code is collapsed for easier visualization. Please click on "code" to expand to view.:::```{r}#| eval: FALSEinstall.packages("tidyverse")install.packages("tidystats")install.packages("expss")install.packages("tidymodels")install.packages("tidystats")install.packages("ggplot2")install.packages("cowplot")install.packages("lubridate")install.packages("gtsummary")install.packages("dplyr")install.packages("paletteer")install.packages("ggthemes")install.packages("pROC")install.packages("sf")install.packages("rstatix")install.packages("labelled")install.packages("tigris")install.packages("dotwhisker")``````{r}#| code-fold: show#| results: falselibrary(tidyverse)library(tidystats)library(dplyr)library(tidymodels)library(ggplot2)library(lubridate)library(gtsummary) library(cowplot) library(expss)library(sf)library(paletteer)library(ggthemes)library(pROC)library(rstatix)library(labelled)library(tigris)options(tigris_use_cache =TRUE)options(progress_enabled =FALSE)library(leaflet)library(dotwhisker)```### Read in & Clean the Data```{r}#| code-fold: show#Read in CSV Filedata<-read.csv("./EDRevisits.csv")#Convert data types as neededdata[data=='']<-NA#converts blanks to NAdata$ENCOUNTER_DATE <-mdy(data$ENCOUNTER_DATE)data$WAITTIME<-period_to_seconds(hms(data$WAITTIME))data$ARRIVALTIME<- lubridate::hms(data$ARRIVALTIME)data$DAILYVISITS<-as.numeric(as.integer(data$DAILYVISITS))#Convert Wait Time from HMS to Minutes and Hoursdata<- data|>mutate(waitmin = WAITTIME/60)|>mutate(waithr = WAITTIME/(60*60))```#### Additional Cleaning```{r}#Merge Revisit & Readmitdata<- data|>mutate (revisit =case_when( REVISIT_72_HR ==0~0, REVISIT_72_HR ==1& READMIT_72_HR ==0~1, READMIT_72_HR ==1~2 ))#Race/Ethnicity Category Collapse & Factordata<- data|>mutate (eth_cat = (case_when(str_detect(RACE_ETHNICITY, "White") ~"White",str_detect(RACE_ETHNICITY, "Black") ~"Black",str_detect(RACE_ETHNICITY, "Asian") ~"Other",str_detect(RACE_ETHNICITY, "Latino") ~"Hispanic/Latino",str_detect(RACE_ETHNICITY, "Multi") ~"Other",str_detect(RACE_ETHNICITY, "Other") ~"Other",str_detect(RACE_ETHNICITY, "Native") ~"Other",str_detect(RACE_ETHNICITY, "nknown") ~"Other",str_detect(RACE_ETHNICITY, "Refused") ~"Other",str_detect(RACE_ETHNICITY, "disclose") ~"Other", )))|>mutate (eth_cat =factor(eth_cat, levels =c("White", "Black", "Hispanic/Latino", "Other"), labels =c("White", "Black", "Hispanic/Latino", "Other")))#Convert ED Volume to Categorical based on Quartilesdata<- data |>mutate (volume =case_when( CAMPUS =="Main"& DAILYVISITS <=244~"Low", CAMPUS =="Main"& DAILYVISITS <=277~"Medium-Low", CAMPUS =="Main"& DAILYVISITS <=307~"Medium-High", CAMPUS =="Main"& DAILYVISITS >307~"High", CAMPUS =="Community"& DAILYVISITS <=90~"Low", CAMPUS =="Community"& DAILYVISITS <=103~"Medium-Low", CAMPUS =="Community"& DAILYVISITS <=114~"Medium-High", CAMPUS =="Community"& DAILYVISITS >114~"High"))#Collapse Arrival Times to 3 Categoriesdata<- data |>mutate (Arrival =case_when(hour(ARRIVALTIME) >=23~"Overnight",hour(ARRIVALTIME) >=15~"Evening",hour(ARRIVALTIME) >=7~"Daytime",hour(ARRIVALTIME) <7~"Overnight" ))#Age to Dichotomousdata<- data |>mutate (age_cat =case_when( AGE_AT_VISIT <1~"Infant", AGE_AT_VISIT >=1~"Child/Teen"))#ED Disposition to Dichotomousdata<- data |>mutate (ED_DISPOSITION =case_when(str_detect(ED_DISPOSITION, "Discharge") ~"Discharge",str_detect(ED_DISPOSITION, "AMA") ~"AMA/Eloped",str_detect(ED_DISPOSITION, "Left Before Discharge (Eloped)") ~"AMA/Eloped"))#Acuity to Dichotomousdata<- data |>mutate (esigp =case_when( ACUITY >=1& ACUITY <=3~"Acute", ACUITY >=4& ACUITY <=5~"Non-Urgent"))#LOS to hours & Removal of LOS < 0 (n = 17)data <- data |>mutate (ED_LOS = ED_LOS/60)|>mutate (ED_LOS =case_when ( ED_LOS <0~NA, ED_LOS >=0~ ED_LOS))#Factordata<- data |>mutate(REVISIT_72_HR =factor(REVISIT_72_HR, levels =c(0,1), labels =c("No Revisit", "Revisit")),LANGIND =factor(LANGIND, levels =c(1,0),labels =c("English","Other")),PCP_VISIT_72_HR =factor(PCP_VISIT_72_HR, levels =c(0,1), labels =c("No PCP Visit", "PCP Visit")),READMIT_72_HR =factor(READMIT_72_HR, levels =c(0, 1),labels =c("Re-discharged", "Admitted")),SEX =factor(SEX, levels =c("M", "F"), labels =c("Male", "Female")),COMPLEX_CHRONIC_CONDITION_IND =factor(COMPLEX_CHRONIC_CONDITION_IND,levels =c(0,1),labels =c("None", "Chronic/Complex")),ACUITY =factor(ACUITY),ED_DISPOSITION =factor(ED_DISPOSITION, levels =c("Discharge", "AMA/Eloped"), labels =c("Discharge", "AMA/Eloped")),CAMPUS =factor(CAMPUS, levels =c("Main", "Community"), labels =c("Main", "Community")),age_cat =factor(age_cat),Arrival =factor(Arrival),PAYOR_GROUP =factor(PAYOR_GROUP, levels =c("COMMERCIAL", "GOVERNMENT", "CHARITY CARE", "SELF PAY"),labels =c("Commercial", "Government", "Charity Care", "Self Pay")),esigp =factor(esigp),volume =factor(volume),GEOID =gsub('.{0,6}$', '', GEOID),COI =factor(COI, levels =c("Very High", "High", "Moderate", "Low", "Very Low"),labels =c("Very High", "High", "Moderate", "Low", "Very Low")),revisit =factor(revisit,levels =c(0,1,2),labels =c("No Revisit", "Revisit to Discharge", "Revisit to Admission")) )#Overall ED Statistics Across Campus/Year/Monthed<- data|>group_by(CAMPUS, Year =as.character(year(ENCOUNTER_DATE)), month =month(ENCOUNTER_DATE, label =TRUE))|>mutate(mdndv =median(DAILYVISITS))|>mutate(mdnesi =median(AVGESI))|>mutate(mdnwt =median(waitmin))|>select(CAMPUS, Year, month, mdndv, mdnesi, mdnwt)|>distinct()#Apply Labelsdata <- data|>apply_labels(ENCOUNTER_DATE ="Date",SEX ="Sex",DAILYVISITS ="Daily Visits",AVGESI ="Acuity",WAITTIME ="Wait Time",AGE_AT_VISIT ="Age",RACE_ETHNICITY ="Race & Ethnicity",LANGIND ="Language",PAYOR_GROUP ="Insurance Type",ED_LOS ="Length of Stay (hr)",REVISIT_72_HR ="Revisit within 72 Hours",READMIT_72_HR ="Admission within 72 Hours",COMPLEX_CHRONIC_CONDITION_IND ="Complex or Chronic History",ED_DISPOSITION ="Disposition from ED",PCP_VISIT_72_HR ="PCP Visit within 72 Hours",eth_cat ="Race/Ethnicity",CAMPUS ="Campus",waitmin ="Wait Time (min)",waithr ="Wait Time (hr)",ACUITY ="Acuity",age_cat ="Age (Categorical)",esigp ="Acuity (Dichotomized)",volume ="ED Volume (Categorical)",Arrival ="Arrival",COI ="Childhood Opportunity Index",revisit ="Revisit within 72 Hours" )```## Results {#sec-results}### Department SummaryContinuous variables were summarized using mean, median, and interquartile range, as appropriate.\Categorical variables were summarized using frequencies and percentages.\A portion of these variables were collapsed into dichotomous variables based on previous research.A total of 211,583 patients \< 19 years old were seen across both emergency department campuses between November 1, 2021 and November 1, 2023. There is a notable difference in daily visits between both campuses, which is expected given the bed availability is much larger at main (\~56) compared to community (\~21). Average acuity was 3.2 and 3.13. Median wait time was 24 minutes and 19 minutes. Median length of stay (LOS) was 3.22 hours and 3.43 hours. At the main campus, a total of 6938 (4.4%) patients returned to the ED following their index visit, and of those 1722 (1.1%) were admitted to the hospital. At the community campus, 2758 (5.1%) patient returned within 72 hours, and 818 (1.5%) were admitted to the hospital.```{r}#Overall Emergency Department Summarytbl_summary(data, include =c(DAILYVISITS, AVGESI, waitmin, ED_LOS, revisit),statistic =list(all_continuous() ~"{median} ({p25}, {p75})" ),by = CAMPUS,missing ="no")|>modify_caption ("**Table 1: Emergency Department Characteristics**") |>modify_header (label ="") |>bold_labels()|>as_gt()|> gt::tab_options(table.font.size =14)```**Department Summary Visualizations**Select between tabs to visualize different variables.::: panel-tabset### Volume```{r}#Plot Daily Volume by Month ggplot(ed, aes(x =month, y = mdndv, color = Year)) +geom_line(aes(group = Year)) +geom_point(size =3) +facet_grid(~CAMPUS) +theme_few() +ggtitle("Daily Volume by Month") +theme(plot.title =element_text(face ="bold"),strip.text.x =element_text(size =13),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(angle=90, vjust=0.8)) +labs(x ="Month", y ="Daily Visit Count") +scale_color_paletteer_d("futurevisions::jupiter")```### Wait Time```{r}#Plot Median Daily Wait Time by Monthggplot(ed, aes(x =month, y = mdnwt, color = Year)) +geom_line(aes(group = Year)) +geom_point(size =3) +facet_grid(~CAMPUS) +theme_few() +ggtitle("Median Daily Wait Time by Month") +theme(plot.title =element_text(face ="bold"),strip.text.x =element_text(size =14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(angle=90, vjust=0.8)) +labs(x ="Month", y ="Mdn Daily Wait Time") +scale_color_paletteer_d("futurevisions::jupiter")```### Acuity```{r}#Plot Median Daily Acuity by Monthggplot(ed, aes(x =month, y = mdnesi, color = Year)) +geom_line(aes(group = Year)) +geom_point(size =3) +facet_grid(~CAMPUS) +theme_few() +ggtitle("Median Daily Acuity by Month") +theme(plot.title =element_text(face ="bold"),strip.text.x =element_text(size =14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(angle=90, vjust=0.8)) +labs(x ="Month", y ="Mdn Daily Acuity") +ylim(min =2.5, max =3.5) +scale_color_paletteer_d("futurevisions::jupiter")```:::#### Maps: Total Visits per CountyInteractive map showing total number of visit counts by county separated by campus.::: column-page::: panel-fill::: {layout="[ [1,1] ]"}#### Total Visits to Main by County```{r}#Create subset of counties from Continental USlocal <-counties(cb =TRUE, resolution ="500k")local <- local |>filter(STATEFP %in%c("42", "10","34", "36","51", "24"))#Develop Count of Number of Patients from Each County by Campusdata.map.main<- data|>filter(CAMPUS =="Main")|>group_by(GEOID)|>mutate(count =n_distinct(VISIT_KEY))|>select(GEOID, count, CAMPUS)|>distinct()#Join Counties and Countsed.map.main<-left_join(local, data.map.main, by ="GEOID")#Transform for Leafleted.map.main <-st_transform(ed.map.main, crs =4326)ed.map.main<-ed.map.main|>filter(!is.na(count))# Pop-up messagepu_main <-paste0(ed.map.main$NAMELSAD,"<br>Visits: ", ed.map.main$count)#Create Value Bins and associated colorsbins <-c(0,10, 100, 500, 1000, 5000, 10000, 50000, Inf)pal <-c("#94d2bd","#0a9396","#E4D9F2", "#f3b3c4","#FF9356","#005f73", "#bb3e03","#AA00C9")pal.main <-colorBin(pal, domain = ed.map.main$count, bins = bins)#Main Leafletleaflet(ed.map.main) |>setView(-75.1652, 39.9526, zoom =6)|>addTiles(urlTemplate ="https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",options =tileOptions(opacity =1)) |>addPolygons(fillColor =~pal.main(count),weight =2,opacity =1,color ="#47544F",dashArray ="3",fillOpacity = .9,highlightOptions =highlightOptions(weight =5,color ="#666",dashArray ="",fillOpacity =0.2,bringToFront =TRUE),popup = pu_main,popupOptions =popupOptions(style =list("font-weight"="normal", padding ="3px 8px"),textsize ="15px",direction ="auto")) |>addLegend(pal = pal.main, values =~count, opacity =0.7, title =NULL,position ="bottomright")```#### Total Visits to Community by County```{r}#Community Leafletdata.map.comm<- data|>filter(CAMPUS =="Community")|>group_by(GEOID)|>mutate(count =n_distinct(VISIT_KEY))|>select(GEOID, count, CAMPUS)|>distinct()ed.map.comm<-left_join(local, data.map.comm, by ="GEOID")ed.map.comm <-st_transform(ed.map.comm, crs =4326)ed.map.comm<-ed.map.comm|>filter(!is.na(count))pu_comm <-paste0(ed.map.comm$NAMELSAD, "<br>Visits: ", ed.map.comm$count)pal.comm <-colorBin(pal, domain = ed.map.comm$count, bins = bins)leaflet(ed.map.comm) |>setView(-75.1652, 39.9526, zoom =6)|>addTiles(urlTemplate ="https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",options =tileOptions(opacity =1)) |>addPolygons(fillColor =~pal.comm(count),weight =2,opacity =1,color ="#47544F",dashArray ="3",fillOpacity = .9,highlightOptions =highlightOptions(weight =5,color ="#666",dashArray ="",fillOpacity =0.2,bringToFront =TRUE),popup = pu_comm,popupOptions =popupOptions(style =list("font-weight"="normal", padding ="3px 8px"),textsize ="15px",direction ="auto")) |>addLegend(pal = pal.comm, values =~count, opacity =0.7, title =NULL,position ="bottomright")```:::::::::------------------------------------------------------------------------### Patient and Visit CharacteristicsThe demographic and clinical characteristics are shown in the table below, separated by campus and revisit status.```{r}#Descriptive Statisticsdata|>select(SEX, AGE_AT_VISIT, age_cat, eth_cat, LANGIND, PAYOR_GROUP, COI, ACUITY, esigp, COMPLEX_CHRONIC_CONDITION_IND, CAMPUS, ED_LOS, Arrival, ED_DISPOSITION, revisit)|>tbl_strata2(strata = CAMPUS,.tbl_fun =~.x |>tbl_summary(by = revisit,missing ="no") |>modify_caption ("**Table 2: Patient and Visit-Level Characteristics**") |>modify_header (label ="**Variable**") |>bold_labels())|>as_gt()|> gt::tab_options(table.font.size =13, container.height =500, container.padding.x =25, container.padding.y =25)```------------------------------------------------------------------------#### Patient-level VisualizationsVisualizations by key factors are shown below, separated by campus and revisit status.::: column-page::: {layout="[ [1,1] ]"}::: panel-tabset## Sex```{r}## Sexggplot(data, aes(x =factor(REVISIT_72_HR), fill = SEX)) +geom_bar(position ="fill") +scale_y_continuous(labels = scales::percent) +ylab("Percentage")+xlab("")+labs(title ="Sex")+theme_minimal()+facet_grid(~CAMPUS) +theme(plot.title =element_text(face ="bold"),#strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(size=8), axis.title.x =element_text(size=8),legend.title =element_blank(),legend.text =element_text(size=8),axis.title.y =element_text(size=10))```## Language```{r}#Languageggplot(data, aes(x =factor(REVISIT_72_HR), fill =factor(LANGIND))) +geom_bar(position ="fill") +scale_y_continuous(labels = scales::percent) +ylab("Percentage")+xlab("")+labs(title ="Language")+theme_minimal()+facet_grid(~CAMPUS) +theme(plot.title =element_text(face ="bold"),# strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(size=6), axis.title.x =element_text(size=10),legend.title =element_blank(),legend.text =element_text(size=4),axis.title.y =element_text(size=10))```## Insurance```{r}#Insuranceggplot(data, aes(x =factor(REVISIT_72_HR), fill = PAYOR_GROUP)) +geom_bar(position ="fill") +scale_y_continuous(labels = scales::percent) +ylab("Percentage")+xlab("")+labs(title ="Insurance")+scale_color_paletteer_d("futurevisions::jupiter")+theme_minimal()+facet_grid(~CAMPUS) +theme(plot.title =element_text(face ="bold"),#strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(size=6), axis.title.x =element_text(size=10),legend.title =element_blank(),legend.text =element_text(size=4),axis.title.y =element_text(size=10))``````{r}#| eval: FALSE# Acuity (Categorical)ggplot(data, aes(x =factor(REVISIT_72_HR), fill =factor(ACUITY))) +geom_bar(position ="fill") +scale_y_continuous(labels = scales::percent) +ylab("Percentage")+xlab("")+labs(title ="Acuity")+theme_minimal()+facet_grid(~CAMPUS) +theme(plot.title =element_text(face ="bold"),#strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(size=6), axis.title.x =element_text(size=10),legend.title =element_blank(),legend.text =element_text(size=4),axis.title.y =element_text(size=10))+scale_fill_paletteer_d("futurevisions::jupiter")```## Acuity```{r}# Acuity (Continuous)ggplot(data, aes(x =factor(REVISIT_72_HR), fill =factor(esigp))) +geom_bar(position ="fill") +scale_y_continuous(labels = scales::percent) +ylab("Percentage")+xlab("")+labs(title ="Acuity")+theme_minimal()+facet_grid(~CAMPUS) +theme(plot.title =element_text(face ="bold"),# strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(size=6), axis.title.x =element_text(size=10),legend.title =element_blank(),legend.text =element_text(size=4),axis.title.y =element_text(size=10))```## COI```{r}# Childhood Opportunity Indexggplot(data, aes(x =factor(REVISIT_72_HR), fill = COI)) +geom_bar(position ="fill") +scale_y_continuous(labels = scales::percent) +ylab("Percentage")+xlab("")+labs(title ="Childhood Opportunity Index")+theme_minimal()+facet_grid(~CAMPUS) +theme(plot.title =element_text(face ="bold"),# strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(size=6), axis.title.x =element_text(size=10),legend.title =element_blank(),legend.text =element_text(size=4),axis.title.y =element_text(size=10))+scale_fill_paletteer_d("futurevisions::jupiter")```## Race/Ethnicity```{r}#Race/Ethnicityggplot(data, aes(x =factor(REVISIT_72_HR), fill = eth_cat)) +geom_bar(position ="fill") +scale_y_continuous(labels = scales::percent) +ylab("Percentage")+xlab("")+labs(title ="Ethnicity")+theme_minimal()+facet_grid(~CAMPUS) +theme(plot.title =element_text(face ="bold"),# strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(size=6), axis.title.x =element_text(size=10),legend.title =element_blank(),legend.text =element_text(size=4),axis.title.y =element_text(size=10))+scale_fill_paletteer_d("futurevisions::jupiter")```:::::: panel-tabset## Chronic/Complex```{r}#Chronicity/Complexityggplot(data, aes(x =factor(REVISIT_72_HR), fill =factor(COMPLEX_CHRONIC_CONDITION_IND))) +geom_bar(position ="fill") +scale_y_continuous(labels = scales::percent) +ylab("Percentage")+xlab("")+labs(title ="Chronic/Complex History")+theme_minimal()+facet_grid(~CAMPUS) +theme(plot.title =element_text(face ="bold"),# strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(size=6), axis.title.x =element_text(size=10),legend.title =element_blank(),legend.text =element_text(size=4),axis.title.y =element_text(size=10))```## PCP Visit```{r}#PCP Visit within 72 hoursggplot(data, aes(x =factor(REVISIT_72_HR), fill =factor(PCP_VISIT_72_HR))) +geom_bar(position ="fill") +scale_y_continuous(labels = scales::percent) +ylab("Percentage")+xlab("")+labs(title ="PCP Visit Within 72 Hours")+theme_minimal()+facet_grid(~CAMPUS) +theme(plot.title =element_text(face ="bold"),# strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(size=6), axis.title.x =element_text(size=10),legend.title =element_blank(),legend.text =element_text(size=4),axis.title.y =element_text(size=10))```## Age (Cont)```{r}# Age (Continuous)ggplot(data, aes(x =factor(REVISIT_72_HR),y = AGE_AT_VISIT, fill = REVISIT_72_HR)) +geom_boxplot() +facet_wrap(~CAMPUS) +theme(plot.title =element_text(face ="bold"),# strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+labs(title ="Age") +ylab("Years")+xlab("")+theme_minimal()+theme( legend.title =element_blank())```## Age (Cat)```{r}# Age (Categorical)ggplot(data, aes(x =factor(REVISIT_72_HR), fill =factor(age_cat))) +geom_bar(position ="fill") +scale_y_continuous(labels = scales::percent) +ylab("Percentage")+xlab("")+labs(title ="Infant vs Child/Teen")+theme_minimal()+facet_grid(~CAMPUS) +theme(plot.title =element_text(face ="bold"),# strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(size=6), axis.title.x =element_text(size=10),legend.title =element_blank(),legend.text =element_text(size=4),axis.title.y =element_text(size=10))```## Dispo```{r}#ED Dispositionggplot(data, aes(x = REVISIT_72_HR, fill = ED_DISPOSITION)) +geom_bar(position ="fill") +scale_y_continuous(labels = scales::percent) +ylab("Percentage")+xlab("")+labs(title ="ED Disposition")+theme_minimal()+facet_grid(~CAMPUS) +theme(plot.title =element_text(face ="bold"),# strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+theme(axis.text.x =element_text(size=6), axis.title.x =element_text(size=10),legend.title =element_blank(),legend.text =element_text(size=4),axis.title.y =element_text(size=10))```## LOS```{r}#ED Length of Stayggplot(data, aes(x =factor(REVISIT_72_HR),y = ED_LOS, fill = REVISIT_72_HR)) +geom_boxplot() +facet_wrap(~CAMPUS) +theme(plot.title =element_text(face ="bold"),# strip.text.x = element_text(size = 14),panel.grid =element_line(color ="lightgrey",linetype ="dotted"))+scale_y_continuous(trans='log10')+labs(title ="Length of Stay") +ylab("Hours (log10)")+xlab("")+theme_minimal()+theme( legend.title =element_blank())```:::::::::### Preliminary AnalysisPreliminary exploratory analysis, including Chi-Square and Univariable Logistic Regression, were performed on all variables included in the data set (expand below to see output).::: {.callout-note collapse="true" appearance="minimal" icon="false"}## Chi-Squares and Univariable Regressions```{r}# Create subset for chi-squaredf<-data%>%select(SEX, LANGIND, eth_cat, PAYOR_GROUP, COI, ACUITY, Arrival, volume, age_cat, esigp, COMPLEX_CHRONIC_CONDITION_IND, PCP_VISIT_72_HR, CAMPUS, ED_DISPOSITION)#Convert to Dataframedf2<-map_df(df,~chisq_test(.x, data$REVISIT_72_HR))#Create list of variable labels and convert to dataframemylist <-list(var_label(df))df3 <-data.frame("Variable"=unlist(mylist, use.names =FALSE) )#Combine the two dataframesdf4<-cbind(df3,df2)#Create tabledf4<-df4|>select(-n, -method)flextable::set_flextable_defaults(digits =3)ftdf<-flextable::as_flextable(df4)ftdf<-ftdf|> flextable::bold(i=~p <0.05, j ="p")|> flextable::bold(part ="header")|> flextable::fontsize(size =10, part ="all")|> flextable::add_header_lines("Chi-Square Tests: Any Revisit")ftdf``````{r}#Create subset to include in regressionlf<-data|>select(SEX, LANGIND, AGE_AT_VISIT, ED_LOS, eth_cat, PAYOR_GROUP, COI, ACUITY, Arrival, volume, waithr, age_cat, esigp, COMPLEX_CHRONIC_CONDITION_IND, PCP_VISIT_72_HR, CAMPUS, ED_DISPOSITION,REVISIT_72_HR)#Regression and Tablet1<-lf|>tbl_uvregression(method = glm, y = REVISIT_72_HR,method.args =list(family=binomial()),exponentiate =TRUE,hide_n =TRUE)|>bold_p(t=0.05)|>italicize_levels()|>modify_caption ("**Table 1: Emergency Department Characteristics**") |>modify_header (label ="") |>bold_labels()t1|>as_gt()|> gt::tab_options(table.font.size =14, container.height =500)```:::### Multivariable Logistic RegressionIn multivariable regression, the following characteristics were associated with a higher odds of revisit within 72 hours: being under 1 years old, having a longer length of stay at the index visit, having Governmental insurance, having a chronic or complex medical condition, index visit arrival during overnight shifts, having an index disposition of eloped or leaving against medical advice, having an index visit at the community campus, or having a visit with a primary care physician within 72 hours of the index visit. Of note, certain factors were associated with a lower odds of revisit. These included: having a longer index visit wait time, being Non-Hispanic Black, having an index acuity of non-urgent, or having no insurance/self-pay.```{r}# Regressionm1 <-glm(REVISIT_72_HR ~ SEX + age_cat + eth_cat + ED_LOS + LANGIND + PAYOR_GROUP + COI + esigp + COMPLEX_CHRONIC_CONDITION_IND + Arrival + ED_DISPOSITION + CAMPUS + PCP_VISIT_72_HR + volume + waithr, data = data, family =binomial())#Tablet3 <-tbl_regression(m1, exponentiate =TRUE) %>%bold_p(t =0.05) %>%bold_labels() %>%italicize_levels()```On return, patients were at higher odds of being admitted if they were under 1 years old, had a longer length of stay at the index visit, had a chronic or complex medical condition, had an index visit arrival during overnight shifts, had an index disposition of eloped/AMA, had an index visit at the community campus, or had a visit with a primary care physician within 72 hours of the index visit. Similarly, certain factors were associated with a lower odds of revisit. These included: having a longer index visit wait time, having an index acuity of non-urgent, or having no insurance/self-pay.```{r}#Create subset of only patient readmitted within 72 hoursreadmit <- data|>select(SEX, AGE_AT_VISIT, age_cat, esigp, eth_cat, LANGIND, PAYOR_GROUP, COI, ACUITY, COMPLEX_CHRONIC_CONDITION_IND, CAMPUS, ED_LOS, Arrival, ED_DISPOSITION, PCP_VISIT_72_HR, volume, waithr, READMIT_72_HR)``````{r}# Regressionm.adm <-glm(READMIT_72_HR ~ SEX + age_cat + eth_cat + ED_LOS + LANGIND + PAYOR_GROUP + COI + esigp + COMPLEX_CHRONIC_CONDITION_IND + Arrival + ED_DISPOSITION + CAMPUS + PCP_VISIT_72_HR + volume + waithr, data = readmit, family =binomial())#Create Tablet.adm <-tbl_regression(m.adm, exponentiate =TRUE) %>%bold_p(t =0.05) %>%bold_labels() %>%italicize_levels()#Merge tables of Any Revisit and Readmissiontbl.merge<-tbl_merge(tbls =list(t3, t.adm),tab_spanner =c("**Any Revisit**", "**Revisit to Admission**"))#Table as gttbl.merge |>as_gt()|> gt::tab_options(table.font.size =14, container.height =500)|> gt::tab_caption("Table 3: Combined table of Multivariable Logistic Regressions by Revisit Status")```------------------------------------------------------------------------Future evaluation will include predictive modeling using random forest.```{r}#| eval: false#| include: false#parsnip approachlogreg_cls_spec <-logistic_reg() |>set_engine("glm")logreg_cls_fit <- logreg_cls_spec |>fit(READMIT_72_HR ~ ., data = readmit)logreg_cls_fittidy(logreg_cls_fit)tidy(logreg_cls_fit) |>dwplot(dot_args =list(size =2, color ="black"),whisker_args =list(color ="black"),vline =geom_vline(xintercept =0, colour ="grey50", linetype =2)) +theme_bw()rf_cls_spec <-rand_forest(trees =1000, min_n =5) |>set_engine("randomForest", importance =TRUE) |>set_mode("classification")rf_cls_specrf_cls_fit <- rf_cls_spec |>fit(READMIT_72_HR ~ ., data = readmit)rf_cls_fitrf.pred.values <-bind_cols(truth = titanic$survived,predict(rf_cls_fit, titanic),predict(rf_cls_fit, titanic, type ="prob"))roc_auc(titanic.rf.pred.values, truth, .pred_died)autoplot(roc_curve(titanic.rf.pred.values, truth, .pred_died))rf_workflow <-workflow() |>add_model(rf_cls_spec) |>add_formula(REVISIT_72_HR ~ .)set.seed(1234)rf_fit_cv <- rf_workflow |>fit_resamples(training.folds, control =control_resamples(save_pred =TRUE))collect_metrics(rf_fit_cv)rf_fit_cv |>collect_predictions() |>roc_curve(survived, .pred_died) |>autoplot()```## ConclusionAt a tertiary, academic, free-standing children's hospital with two emergency department campuses, 4.6% of patients returned to the ED within 72 hours of being discharged. Of those, 26% were admitted to the hospital on their return visit. This is consistent with national revisit trends at comparable children's hospitals. Similar to previous studies, presence of chronic/complex conditions, younger age, and later ED arrival time were associated with increased risk for revisit.When considering disparities, consistent with prior data, publicly insured individuals were more like to return to the ED, but were not more likely to be hospitalized upon return. Non-Hispanic Blacks were less likely to return, but were not less likely to be admitted upon return. Patients without insurance/self-pay were significantly less likely to revisit or be hospitalized upon return. This should be further explored to elucidate whether this is due to provider bias vs familial preference. It would also be interesting to examine whether these patients overall receive less workup and fewer diagnostic tests. Compared to other studies, there was no association between non-English language proficiency and increased risk of return. This may be explained by recent expanded hospital efforts to have video and in-person translators available in multiple languages. Childhood opportunity index was also not associated with revisit rates, contrary to previous studies.Additionally, we found that patients who visited their PCP within 72 hours were associated with increased risk of hospitalization upon return. This goes against conventional belief that increased access to one's PCP should decrease need for ED use. The current findings may may be explained if sicker patients are more likely to request PCP follow-up, but further exploration is necessary, particularly by examining outcomes of the associated PCP visits and whether ED referrals from said visits were made.There are some notable limitations of this study. First, reason for revisit is not easily assessed. Patients may return to the ED for many reasons, including disease progression, as instructed for repeat testing, or because of incomplete care or inadequate discharge instructions. We are also unable to determine if the patient is returning for a completely unrelated reason. Second, our data does not include a revisit to EDs outside of the single academic institution, so the true rate may be higher than reported. However, our rates are consistent with national averages.Overall, this study has shown that certain patient and visit-level factors are associated with either an increased or decreased risk of revisit to the emergency department. Most patients who do re-present will be re-discharged, but those that aren't tend to be younger and chronically ill. This work gives us benchmarks and better areas of focus to reduce disparities in care and provide appropriate resources to patients. Future efforts should examine the role of and the communication with the pediatrician at the index visit.## References1. Akenroye, Ayobami T., et al. "Prevalence and predictors of return visits to pediatric emergency departments." *Journal of hospital medicine* 9.12 (2014): 779-787.2. Alessandrini, Evaline A., et al. "Return visits to a pediatric emergency department." *Pediatric emergency care* 20.3 (2004): 166-171.3. Cho CS, Shapiro DJ, Cabana MD, Maselli JH, Hersh AL. A national depiction of children with return visits to the emergency department within 72 hours, 2001--2007. *Pediatr Emerg Care*. (2012): 606-610.4. Goldman, Ran D., Michael Ong, and Alison Macpherson. "Unscheduled return visits to the pediatric emergency department-one-year experience." *Pediatric emergency care* 22.8 (2006): 545-549.5. Jacobstein CR, Alessandrini EA, Lavelle JM, Shaw KN. Unscheduled revisits to a pediatric emergency department: risk factors for children with fever or infection-related complaints. *Pediatr Emerg Care*. (2005): 816-821.6. LeDuc K, Rosebrook H, Rannie M, Gao D. Pediatric emergency department recidivism: demographic characteristics and diagnostic predictors. *J Emerg Nurs*. (2006): 131-138.